using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MAPDavy.Entities;

namespace MAPDavy.Repository.Mapping
{
	public class StudentMap : EntityTypeConfiguration<Student>
	{
		public StudentMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.Id)
				.IsRequired()
				.IsFixedLength()
				.HasMaxLength(6);

            this.Property(t => t.DavyId)
                .IsRequired();
				
			this.Property(t => t.LastName)
				.IsRequired()
				.HasMaxLength(250);
				
			this.Property(t => t.FirtsName)
				.IsRequired()
				.HasMaxLength(250);
				
			this.Property(t => t.Gender)
				.IsRequired()
				.IsFixedLength()
				.HasMaxLength(1);
				
			// Table & Column Mappings
			this.ToTable("Student");
			this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.DavyId).HasColumnName("DavyId");
			this.Property(t => t.LastName).HasColumnName("LastName");
			this.Property(t => t.FirtsName).HasColumnName("FirtsName");
			this.Property(t => t.BirtDate).HasColumnName("BirtDate");
			this.Property(t => t.Gender).HasColumnName("Gender");
			this.Property(t => t.FilePhotoName).HasColumnName("FilePhotoName");
            this.Property(t => t.FechaIngreso).HasColumnName("FechaIngreso");
		}
	}
}

